package com.acme.bankapp.domain.bank;

import java.io.Serializable;

import com.acme.bankapp.domain.bank.exception.AccountAlreadyAssignedException;
import com.acme.bankapp.domain.bank.exception.NotEnoughFundsException;

/**
 * Bank account.
 * 
 */
public interface Account extends Serializable {
	/**
	 * Adds funds to client's account.
	 * 
	 * @param amount
	 *            amount of funds, must be positive
	 */
	void deposit(double amount);

	/**
	 * Withdraws funds from client's account. If amount exceeds maximum
	 * available amount to withdraw, method does nothing.
	 * 
	 * @param amount
	 *            amount of funds to withdraw, must be positive
	 * @throws NotEnoughFundsException
	 */
	void withdraw(double amount) throws NotEnoughFundsException;

	/**
	 * Returns account balance.
	 * 
	 * @return account balance
	 */
	double getBalance();

	/**
	 * Returns maximum amount of funds o withdraw.
	 * 
	 * @return maximum amount of funds to withdraw
	 */
	double maximumAmountToWithdraw();

	/**
	 * Returns client, assigned to the current bank account.
	 * 
	 * @return assigned client
	 */
	Client getClient();

	/**
	 * Assigns client to the bank account.
	 * 
	 * @param client
	 * @param unique
	 *            account identifier (up to the client)
	 * @throws AccountAlreadyAssignedException
	 */
	void assignToClient(Client client, String uuid)
			throws AccountAlreadyAssignedException;

	/**
	 * Returns unique account identifier. This UUID is unique only for accounts
	 * assigned to the same client.
	 * 
	 * @return unique identifier
	 */
	public String getUUID();

	/**
	 * Returns round balance.
	 * 
	 * @return round balance
	 */
	public long decimalValue();
}
